fix: use canonical www.codebuff.com URL for fallbacks - #840
fix: use canonical www.codebuff.com URL for fallbacks#840OmarAlaaeldein wants to merge 1 commit into
Conversation
|
Good catch and a minimal, focused diff. Using A few things worth checking before porting:
Overall this is small, well-reasoned, and easy to verify/port by hand. |
When fallback URLs point to codebuff.com, the server redirects to www.codebuff.com with a 301 redirect. During this redirect, Node's fetch client strips the Authorization header (for security reasons), causing validation/session requests to fail with a 401 Unauthorized. This changes hardcoded fallbacks to the canonical www.codebuff.com to avoid redirect-induced credential stripping.
64646e3 to
5320624
Compare
|
Rebased onto current main. The session endpoint moved to cli/src/utils/freebuff-session-api.ts, so the canonical fallback is applied there along with the error-handling fallback and SDK examples. Verified both endpoints: the bare domain redirects to https://www.codebuff.com/api/v1/freebuff/session, and the canonical endpoint serves that route (both correctly return 401 without credentials). I also searched the remaining NEXT_PUBLIC_CODEBUFF_APP_URL fallbacks; the only other one is an unauthenticated release-download URL, so it is outside this Authorization-header redirect issue. |
This PR fixes a silent authorization header-stripping issue during local development/testing.
https://codebuff.comto the canonicalhttps://www.codebuff.com.codebuff.comtowww.codebuff.comwhich causes Node'sfetchclient to strip theAuthorizationheader for security reasons, resulting in a silent401 Unauthorizederror.